//
//  FoodsViewController.swift
//  beegin2
//
//  Created by zsy on 16/3/11.
//  Copyright © 2016年 kszz. All rights reserved.
//

import UIKit

class FoodsViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {

    @IBOutlet weak var SearchBackView:UIView!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        SearchBackView.layer.borderColor = UIColor(red: 72 / 255, green: 207 / 255, blue: 173 / 255, alpha: 100).CGColor
        SearchBackView.layer.borderWidth = 3
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    @IBAction func leftNavClick(sender: AnyObject) {
        
        self.dismissViewControllerAnimated(true, completion: nil)
    }

    
    // MARK: - UITableViewDelegate
    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath){
        
        if indexPath.section == 0 && indexPath.row == 0{
            
            //self.performSegueWithIdentifier("showMilkBrandSegue", sender: self)
        }
        
        tableView.deselectRowAtIndexPath(indexPath, animated: true)
    }
    
    func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        
        return nil
    }
    
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        
        return 4
    }
    
    func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        
        return 0
    }
    func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
        return 0
    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        
        let identifier = "foodCell"
        let cell = tableView.dequeueReusableCellWithIdentifier(identifier , forIndexPath: indexPath)
        
        let imageView = UIImageView(image: UIImage(named: "segment1"))
        imageView.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
        imageView.tag = 12
        imageView.contentMode = .Center
      //  cell.addSubview(imageView)
        
        let label = UILabel(frame: CGRect(x: 0, y: 0, width: 40, height: cell.frame.height))
        label.textAlignment = .Right
        label.textColor = UIColor(red: 74 / 255, green: 74 / 255, blue: 74 / 255, alpha: 100)
        label.text = "二段"
        label.tag = 11
        cell.addSubview(label)
        label.font = UIFont(name: "System", size: 4 )
        cell.imageView?.image = UIImage(named: "content_img")
         //print(cell.frame)
        return cell
    }

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
